<div class="mainleftsp"> 
      <div class="mainleftlogin">
      
        <div class="main_prod_notes">
        
			<{if $isError}>
			<div class="error">
				<{if $errMsg=="existedEmail"}>
          		Your registration with email <b><{$email}></b> is existed.
          		<{else}>
          		Your registration with username <b><{$username}></b> is existed.
          		<{/if}> 
          	</div>
			<{/if}>
          <form action="<{$APPLICATION_URL}>/Browse/Signup" method="post" name="signup_form">
          <div class="loginsignupform"> 
            <div class="full">Your Details</p></div>
            <div class="right"><input class="textfieldform" type="text" name="firstName" id="firstName" value="<{$firstName}>" /></div>
			<div class="left"><span class="formlab">First Name:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="lastName" id="lastName" value="<{$lastName}>" /></div>
			<div class="left"><span class="formlab">Last Name:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="email" id="email" value="<{$email}>" /></div>
			<div class="left"><span class="formlab">Email:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="confirmEmail" id="confirmEmail" value="<{$confirmEmail}>" /></div>
			<div class="left"><span class="formlab">Re-Type Email:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="address" id="address" value="<{$address}>" /></div>
			<div class="left"><span class="formlab">House Name/Number:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="telephone" id="telephone" value="<{$telephone}>" /></div>
			<div class="left"><span class="formlab">Phone:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="city" id="city" value="<{$city}>" /></div>
			<div class="left"><span class="formlab">City/Town:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="text" name="state" id="state" value="<{$state}>" /></div>
			<div class="left"><span class="formlab">State:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right">
            	<select name="country" id="country" textfieldform>
					<option value="">- - - - -</option>
					<{html_options options = $listCountry selected=$country}>
				</select>
            </div>
			<div class="left"><span class="formlab">Country:</span></div>
          </div>
          
          <div class="loginsignupform"> 
            <div class="full">Profile Details</div>
            <div class="right"><input class="textfieldform" type="text" name="username" id="username" value="<{$username}>" maxlength="12" /></div>
			<div class="left"><span class="formlab">Username:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="password" name="password" id="password" value="<{$password}>" /></div>
			<div class="left"><span class="formlab">Password:</span></div>
          </div>
          <div class="loginsignupform">
            <div class="right"><input class="textfieldform" type="password" name="passwordRetype" id="passwordRetype"/></div>
			<div class="left"><span class="formlab">Re-Type:</span></div>
          </div>
          <div class="loginsignupform"> 
            <div class="full"><br /><br />Terms &amp; Conditions</div>
            <div style="width:100%; height: 200px; overflow-y:scroll; float:left">
            	<{include file="Browse/TermAndCondition/term_condition.tpl"}>
            </div>
          </div>
          <div class="loginsignupform">
          	<input type="checkbox" id="cbAgreeTOS" /><label for="cbAgreeTOS">I accept terms of use</label>
          </div>
          <div class="full">
          	<input type="hidden" name="actionForm" id="actionForm" value="">
          	<input class="signupbutton" name="Signup" type="button" value="Sign Up" onclick="return Onsubmit();"/>
          </div>          
          </form>
        </div>
      
      </div>
    </div>

<script type="text/javascript" language="javascript">    
    function Onsubmit(){
		var theform	= document.signup_form;

		var firstName = theform.firstName.value;
		if(firstName == ""){
			alert("Please enter your Name!");
			theform.firstName.focus();
			return false;
		}

		var lastName = theform.lastName.value;
		if(lastName == ""){
			alert("Please enter your Name!");
			theform.lastName.focus();
			return false;
		}
				
		var email = theform.email.value;
		var confirmEmail = theform.confirmEmail.value;
		if(email == ""){
			alert("Please enter your Email");
			theform.email.focus();
			return false;
		}
		
		if(email != confirmEmail ){
			alert("Email and Re-Email do not match.");
			theform.confirmEmail.focus();
			return false;
		}
		
		// Validate Email
		if (!isEmail(email)){
			alert('Email is invalid');
			theform.email.focus();
			return false;
    	}

		var address = theform.address.value;
		if(address == ""){
			alert("Please enter your address!");
			theform.address.focus();
			return false;
		}

		var telephone = theform.telephone.value;
		var numberOnlyRegex = /^[0-9]+$/;
		if(telephone == "" || !telephone.match(numberOnlyRegex)){
			alert("Please enter valid telephone number!");
			theform.telephone.focus();
			return false;
		}

		var city = theform.city.value;
		if(city == ""){
			alert("Please enter your city!");
			theform.city.focus();
			return false;
		}

		var state = theform.state.value;
		if(state == ""){
			alert("Please enter your state!");
			theform.state.focus();
			return false;
		}

		var country = theform.country.value;
		if(country == ""){
			alert("Please select your country!");
			theform.country.focus();
			return false;
		}

		var username = theform.username.value;
		if(username == "" || trim(username) == ""){
			alert("Please enter your username");
			theform.username.focus();
			return false;
		}
		
		var password		= theform.password.value;
		var passwordRetype	= theform.passwordRetype.value;	
		if(password == "" || trim(password) == ""){
			alert("Please enter your Password.");
			theform.password.focus();
			return false;
		}
		
		if(passwordRetype != password ){
			alert("Passsword and Re-Password do not match.");
			theform.passwordRetype.focus();
			return false;
		}

		if (!document.getElementById("cbAgreeTOS").checked) {
			alert("You must accept terms of use.");
			return false;
		}

		

		theform.actionForm.value = 'submit';
		theform.submit();
		return true;
    }
</script>